package my.projects.work;

import android.graphics.Canvas;
import android.graphics.Paint;


class Blade {
	
	static boolean press=false;
	private int xFirst;
	private int yFirst;
	private int xLast;
	private int yLast;
	private int middleX;
	private Paint paint=new Paint();
	
	public Blade(int xF, int yF,int xL, int yL, Paint p) {
		xFirst=xF;
		yFirst=yF;
		xLast=xL;
		yLast=yL;
		paint=p;
		middleX=xFirst+(xLast-xFirst)/2;
	}
	
	public void draw(Canvas canvas) {
		
		canvas.drawLine(xFirst, yFirst, xLast, yLast, paint);
	}
	
	public boolean belongsToBlade(int x, int y) {
		if (x>xFirst && x<xLast && Math.abs(yFirst-y)<8)
			return true;
		else
			return false;
	}
	
	public void setYFirst(int y) {
		yFirst=y;
		yLast=y;
	}
	
	public void setX(int x) {
		xFirst=xFirst+(x-middleX);
		xLast=xLast+(x-middleX);
		middleX=xFirst+(xLast-xFirst)/2;
	}
	
	public int getYFirst() {
		return yFirst;
	}
	
	public int getXFirsrt() {
		return xFirst;
	}
	
	public int getXLast() {
		return xLast;
	}
}